package com.student.entity;

import java.util.List;

public class PageTool {
	/*
	在分页显示的前提下,显示JSP需要以下数据
	当前页 ,			currentPage
	页面大小,			pageSize
	当前页面数据集合,	stuPage
	总数据,			totalCount
	总页数			totalPage
--将这些数据封装到一个实体类(Page)中.
*/
	private  int currentPage;
	private  int pageSize;
	private  List<StudentInfo> stuPage;
	private  int totalCount;
	private  int totalPage;
	
	public PageTool() {
	
	}
	
	public PageTool(int currentPage, int pageSize, List<StudentInfo> stuPage, int totalCount) {
		this.currentPage = currentPage;
		this.pageSize = pageSize;
		this.stuPage = stuPage;
		this.totalCount = totalCount;
	}
	
	public PageTool(int currentPage, int pageSize, List<StudentInfo> stuPage, int totalCount, int totalPage) {
		super();
		this.currentPage = currentPage;
		this.pageSize = pageSize;
		this.stuPage = stuPage;
		this.totalCount = totalCount;
		this.totalPage = totalPage;
	}

	public int getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getPageSize() {
		return pageSize;
	}
//当调用总数据数的set(),和页面大小set()后计算总页数
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	//计算方法：	
		this.totalPage= this.totalCount%this.pageSize==0?
			this.totalCount/this.pageSize:this.totalCount/this.pageSize+1;
	}
	public List<StudentInfo> getStuPage() {
		return stuPage;
	}
	public void setStuPage(List<StudentInfo> stuPage) {
		this.stuPage = stuPage;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
	public int getTotalPage() {
		return totalPage;
	}

//总页数可以根据计算求得，不需要赋值,设置完页面大小后计算	
/*	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
*/	
	
}
